<template>
	<div class="wrapper">
		<!--header部分-->
		<header>
			<div class="back" @click="toMy">
			<i class="fa fa-chevron-left"></i>
			</div>
			<div class="text">我的钱包</div>
		</header>
		
		<!--资产部分-->
		<div class="assets">
			<div class="up">
				<div class="totalassets">
					<div class="text">账户余额（元）</div>
					<div class="number" >{{updateuser.walletBalance}}</div>
				</div>
				<div class="detailed" @click="toDetailed">
					<i class="fa fa-list-ul"></i>
					<div class="text">全部明细</div>
				</div>
			</div>
		</div>
		<!--充值部分-->
		<div class="a" @click="toCz">
		<div class="cz">充值</div>
		</div>
		<!--提现部分-->
		<div class="b" @click="toTx">
		<div class="tx">提现</div>
		</div>
	</div>
</template>

<script>
	export default {
		name: 'wallet',
		data() {
			return {
				updateuser:{},
				user: {},
				userwalletArr:[],
				userwallet:{},
			}
		},
		created(){
			this.user = this.$getSessionStorage('user');
			this.$axios.post('UserController/getUserByUserId',this.$qs.stringify({
				userId:this.user.userId,
			})).then(response=>{
				this.updateuser=response.data;
			}).catch(error => {
				console.error(error);
			});
		},
		methods: {
			
			
			toMy() {
				this.$router.push({
					path: '/my'
				});
			},
			toDetailed() {
				this.$router.push({
					path: '/detailed'
				});
			},
			toCz() {
				if(this.updateuser.cartId==null){
					this.$router.push({path:'/bind'});
				}
				else{
				this.$router.push({path: '/cz'});}
			},
			toTx() {
				this.$router.push({
					path: '/tx'
				});
			},
			
		}
	}
</script>

<style scoped>
	/****************** 总容器 ******************/
	.wrapper {
		width: 100%;
		height: 100%;
		background-color: azure;
	}
	/****************** header ******************/
	.wrapper header{
		width: 100%;
		height: 12vw;
		background-color: #FFF;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		margin-bottom: 1vw;
	}
	.wrapper header .back{
		font-size: 4vw;
		margin-left: 2vw;
		margin-right: 2vw;
	}
	.wrapper header .text{
		font-size: 4vw;
	}
	/****************** 资产 ******************/
	.wrapper .assets{
		width: 100%;
		height: 14vw;
		background-color: whitesmoke;
		display: flex;
		margin-bottom: 50vw;
	}
	.wrapper .assets .up{
		width: 100%;
		height: 14vw;
		background-color: lightblue;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.wrapper .assets .up .totalassets{
		width: 50%;
		height:14vw;
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	.wrapper .assets .up .totalassets .text{
		margin-left: 2vw;
		margin-right: 3vw;
		font-size: 4vw;
	}
	.wrapper .assets .up .totalassets .number{
		font-size: 4vw;
	}
	.wrapper .assets .up .detailed{
		width: 50%;
		height: 14vw;
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}
	.wrapper .assets .up .detailed i{
		font-size: 4vw;
	}
	.wrapper .assets .up .detailed .text{
		margin-left: 1vw;
		margin-right: 2vw;
		font-size: 4vw;
	}
	/****************** 充值 ******************/
	.wrapper .a{
		width: 100%;
		height: 10vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.wrapper .a .cz{
		width: 30%;
		height: 8vw;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: lightblue;
	}
	/****************** 提现 ******************/
	.wrapper .b{
		width: 100%;
		height: 10vw;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.wrapper .b .tx{
		width: 30%;
		height: 8vw;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: lightblue;
	}
</style>
